import re
import sys

with open('benchmarks' + sys.argv[1] + '.txt', 'r') as f:
    lines = f.readlines()

start_drop_data = re.findall(r'\((\d+),(\d+)\)\((\d+),(\d+)\)', lines[0])
end_drop_data = re.findall(r'\((\d+),(\d+)\)\((\d+),(\d+)\)', lines[1])
obstacle_data = re.findall(r'\((\d+),(\d+)\)\((\d+),(\d+)\)', lines[2])

with open('input.txt', 'w') as file:
    file.write(str(len(start_drop_data)) + str("\n"))
    for drop in start_drop_data:
        row, col, width, height = map(int, drop)
        file.write(str(row) + " " + str(col) + " " + str(width) + " " + str(height) + "\n")
    file.write(str(len(end_drop_data)) + str("\n"))
    for drop in end_drop_data:
        row, col, width, height = map(int, drop)
        file.write(str(row) + " " + str(col) + " " + str(width) + " " + str(height) + "\n")
    file.write(str(len(obstacle_data)) + str("\n"))
    for obs in obstacle_data:
        row, col, width, height = map(int, obs)
        file.write(str(row) + " " + str(col) + " " + str(width) + " " + str(height) + "\n")
